package com.gopay.common.cps.dao.bank.impl;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.bank.BisAppPayDAO;
import com.gopay.common.cps.dao.bank.BisCreditExPayDAO;
import com.gopay.common.domain.bis.BisAppPayConfig;
import com.gopay.common.domain.bis.BisCreditExPayConfig;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @BisAppPayDAOImpl.java
 * @author dongdh
 * @2016-8-5 下午2:56:09  www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("bisAppPayDAO")
public class BisAppPayDAOImpl extends BaseDAOImpl<BisAppPayConfig, Serializable> implements BisAppPayDAO {

    @Override
    public BisAppPayConfig getBisAppPayByBankCodeAndInterfaceCode(String bankCode, String interfaceCode) {
        Map<String,Object> params = new HashMap<String,Object>();
        params.put("bankCode", bankCode);
        params.put("chCode", interfaceCode);
        List<BisAppPayConfig> l = super.findByHql("from BisAppPayConfig where del=0 and bankCode=:bankCode and chCode =:chCode ", params);
        return l.size() > 0 ? l.get(0) : null;
    }

    @Override
    public List<BisAppPayConfig> getBisAppPayConfigByBankCode(String bankCode) {
        Map<String,Object> params = new HashMap<String,Object>();
        params.put("bankCode", bankCode);
        return super.findByHql("from BisAppPayConfig where del=0 and bankCode=:bankCode and enable=1 ", params);
    }

}
